﻿<HTML>
	<H1>
		Delphi 7 ActiveX Test Page
	</H1>
	<p>
		You should see your Delphi 7 forms or controls embedded in the form
		below.
	<HR>
	<center>
		<P>
			<script language="javascript">
 /**
  FPortNo,             // 通信端口 1,2,3
  FReaderType,         // 读写器类型 
  FCardType,           // 卡类型：  $41: 表示EM4150卡, $44: 表示EM4469卡.
  FSector,             // 一般情况下，EM4150卡默认为3; EM4469卡默认为5; 
  FBlock:Byte;         // 未用到 ;   客人卡默认0块 
  Hotel:String;       //
  HotelPwd:String;
  LockNo:integer;      //锁号
  CardID:integer;      //卡id
  SubCardID:integer;   //子卡id
  Time:String;        //有效期
  StartSuite:integer;
  EndSuite:integer;  //可开房号
 **/ 
  function init(){
     xxxx.HotelPwd = '11111111';
     xxxx.Hotel =  'BTLOCK56';
	 xxxx.FPortNo = document.getElementById('FPortNo').value; 
     xxxx.FReaderType = document.getElementById('FReaderType').value ;  
	 xxxx.FCardType =  document.getElementById('FCardType').value  ; 
	 xxxx.FSector = document.getElementById('FSector').value ;
	 xxxx.FBlock = 0 ; 
  }
  function changeSec(obj){
    if(obj.value=='0'){
        document.getElementById('FSector').value =3;
    }else if(obj.value=='1'){
        document.getElementById('FSector').value =5;
    }
  }
  
  function readCard(){
      init();
      xxxx.readCard();
      document.getElementById('LockNo').value = xxxx.LockNo;
      document.getElementById('CardID').value = xxxx.CardID; 
      document.getElementById('SubCardID').value = xxxx.SubCardID; 
      document.getElementById('FTime').value = xxxx.FTime;
      document.getElementById('StartSuite').value = xxxx.StartSuite;  
      document.getElementById('EndSuite').value = xxxx.EndSuite;   
  }
    function readSn(){
      init();
      xxxx.readSnr();
      document.getElementById('sn').value = xxxx.SNR; 
  }

 function writeCard(){
      init();
      xxxx.LockNo  = document.getElementById('LockNo').value   ;
      xxxx.CardID = document.getElementById('CardID').value ; 
      xxxx.SubCardID = document.getElementById('SubCardID').value ; 
      xxxx.FTime =document.getElementById('FTime').value;
      xxxx.StartSuite= document.getElementById('StartSuite').value;  
      xxxx.EndSuite=document.getElementById('EndSuite').value;   
      xxxx.writeCard(); 
  }
</script>
			<body>
				<OBJECT id="xxxx"
					classid="clsid:130D6F39-2FE2-45FB-92B3-AE73D5B2B4EC"
					codebase="CarMngProj1.ocx" width=350 height=250 align=center
					hspace=0 vspace=0>
				</OBJECT>
				</br>
				<table>
					<tr>
						<td align=right>
							发卡器类型:
						</td>
						<td align=left>
							<select id=FReaderType >
								<option value='1'>
									BTEM232
								</option>
								<option value='2' selected>
									BTIB232
								</option>
							</select>
						</td>
						<td align=right>
							卡类型：
						</td>
						<td align=left>
							<select id=FCardType onchange="changeSec(this)">
								<option value='0'>
									EM4150
								</option>
								<option value='1' selected>
									EM4469
								</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align=right>
							com:
						</td>
						<td align=left>
							<select id=FPortNo>
								<option value='1' selected>
									COM1
								</option>
								<option value='2'>
									COM2
								</option>
								<option value='3'>
									COM3
								</option>
								<option value='4'>
									COM4
								</option>
							</select>
						</td>
						<td align=right>
							卡使用地址：
						</td>
						<td align=left>
							<input id="FSector" type="text" value="5" size='10'>
						</td>
					</tr>
					<tr>
						<td align=right>
							锁号:
						</td>
						<td align=left>
							<input id="LockNo" type="text" value="" size='10'>
						</td>
						<td align=right>
							卡号:
						</td>
						<td align=left>
							<input id="CardID" type="text" value="" size='10'>
						</td>
					</tr>
					<tr>
						<td align=right>
							子卡号:
						</td>
						<td align=left>
							<input id="SubCardID" type="text" value="" size='10'>
						</td>
						<td align=right>
							有效日期:
						</td>
						<td align=left>
							<input id="FTime" type="text" value="" size='10'>
						</td>
					</tr>
					<tr>
						<td align=right>
							开始号:
						</td>
						<td align=left>
							<input id="StartSuite" type="text" value="" size='10'>
						</td>
						<td align=right>
							结束号:
						</td>
						<td align=left>
							<input id="EndSuite" type="text" value="" size='10'>
						</td>
					</tr>
					<tr>
						<td align=right>
							卡序列号:
						</td>
						<td align=left>
							<input id="sn" type="text" value="" size='10'>
						</td>
					</tr>


				</table>
				<input name='read' type="button" value='读取'
					onclick=" readCard();" />
				<input name='write' type="button" value='写入'
					onclick=" writeCard();" />
				<input name='sn' type="button" value='读取序列号'
					onclick=" readSn();" />
	
			</body>
</HTML>
